import time
import unittest

from selenium import webdriver
from Page import Page
from ddt import ddt,unpack,file_data,data
from exlsx import exlsx
path = r'D:\gao5_2210\lianxik\ui222\login.xlsx'
sheetname = 'Sheet1'
dy = exlsx(path, sheetname)
@ddt()
class MyTestCase(unittest.TestCase):

    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        print(f'start case')

    def tearDown(self) -> None:
        self.driver.quit()
        time.sleep(3)
        print(f'end case')
    @data(*dy.getdata())
    @unpack
    def test_login_01(self,username,password):
        po = Page(self.driver)
        po.open_url('http://localhost:8081/xklogin')
        po.username1(username)
        time.sleep(3)
        po.password1(password)
        time.sleep(3)
        po.login()
        time.sleep(3)
        po.sure()
        time.sleep(3)
        self.assertEqual(True, True)  # add assertion here


if __name__ == '__main__':
    unittest.main()
